import socket
import struct

def send_router_solicitation(interface):
    # Create an IPv6 UDP socket
    sock = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)

    # Prepare IPv6 router solicitation
    ipv6_header = b'\x60\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00'
    router_solicitation = b'\x01\x01\x00\x00' + b'\x00' * 12

    # Assemble IPv6 packet
    packet = ipv6_header + router_solicitation

    # Send router solicitation
    sock.sendto(packet, ('ff02::2', 0, 0, interface))

    print("Sending Router Solicitation")

if __name__ == "__main__":
    try:
        # Get user input for the network interface name
        interface = input("Please enter the network interface name: ")

        # Send router solicitation
        send_router_solicitation(interface)
    except Exception as e:
        print("\033[1;31;40m[*] Error occurred:", e)
        print("\033[1;37;40m")
